using Easislides.Properties;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Easislides
{
    public class FrmMediaPlayerControl : Form
    {
        private enum ControlsBtn
        {
            PlayPausebtn,
            Stopbtn,
            FFbtn,
            FRbtn,
            Closebtn
        }
        private IContainer components = null;
        private GroupBox groupBox2;
        private TrackBar TrackBarBalance;
        private TrackBar TrackBarVolume;
        private CheckBox cbMute;
        private Label label3;
        private Label label2;
        private Label label1;
        private Label label4;
        private Label label5;
        private Label label6;
        private TrackBar TrackBarDuration;
        private Label LabelPosition;
        private Label LabelDuration;
        private Label label8;
        private Label label7;
        private Button FastForwardBtn;
        private Button FastReverseBtn;
        private Button PlayPauseBtn;
        private Button StopBtn;
        private Button BtnCancel;
        private Button BtnOK;
        private CheckBox cbRepeat;
        private OpenFileDialog OpenFileDialog1;
        private Timer TimerFast;
        private Timer TimerTrack;
        private GroupBox groupBox1;
        private Panel panelLinkTitle2Lookup;
        private ToolStrip toolStripLocate;
        private ToolStripButton LocationBtn;
        private Panel panel1;
        private TextBox tbSourceLocation;
        private RadioButton SourceOption0;
        private RadioButton SourceOption2;
        private RadioButton SourceOption1;
        private ToolTip toolTip1;
        private Label LabelMediaType;
        private Label label10;
        private Timer TimerAttemptConnect;
        private RadioButton SourceOption3;
        private Panel panelPlayBtns;
        private Label labelNoPlayer1;
        private Label labelNoPlayer2;
        private Panel panelNoPlayer;
        private Label label9;
        private Label label14;
        private Label label13;
        private Label label12;
        private Label label11;
        private CheckBox cbWidescreen;
        private Panel panel47;
        private ToolStrip toolStripCaptureDevices;
        private ToolStripComboBox cbCaptureDevices;
        private Label label15;
        private Label LabelResolution;
        private bool InitLoad = true;
        private double TimeIncrement = 1.0;
        private string PreviousStatus = "";
        private bool PreviousMuteState = false;
        private string Option1MediaFile = "";
        private int AttemptConnectCount = 0;
        private int MaxAttemptConnectCount = 60;
        private DShowLib DShowPlayer = new DShowLib();
        private bool PlayerOK = false;
        protected override void Dispose(bool disposing)
        {
            if (disposing && this.components != null)
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.LabelResolution = new System.Windows.Forms.Label();
            this.label15 = new System.Windows.Forms.Label();
            this.cbWidescreen = new System.Windows.Forms.CheckBox();
            this.LabelMediaType = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.panel1 = new System.Windows.Forms.Panel();
            this.panelNoPlayer = new System.Windows.Forms.Panel();
            this.label9 = new System.Windows.Forms.Label();
            this.labelNoPlayer2 = new System.Windows.Forms.Label();
            this.labelNoPlayer1 = new System.Windows.Forms.Label();
            this.cbRepeat = new System.Windows.Forms.CheckBox();
            this.LabelPosition = new System.Windows.Forms.Label();
            this.LabelDuration = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.TrackBarBalance = new System.Windows.Forms.TrackBar();
            this.TrackBarVolume = new System.Windows.Forms.TrackBar();
            this.cbMute = new System.Windows.Forms.CheckBox();
            this.panelPlayBtns = new System.Windows.Forms.Panel();
            this.TrackBarDuration = new System.Windows.Forms.TrackBar();
            this.StopBtn = new System.Windows.Forms.Button();
            this.PlayPauseBtn = new System.Windows.Forms.Button();
            this.FastReverseBtn = new System.Windows.Forms.Button();
            this.FastForwardBtn = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.BtnCancel = new System.Windows.Forms.Button();
            this.BtnOK = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.TimerFast = new System.Windows.Forms.Timer(this.components);
            this.TimerTrack = new System.Windows.Forms.Timer(this.components);
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.panel47 = new System.Windows.Forms.Panel();
            this.toolStripCaptureDevices = new System.Windows.Forms.ToolStrip();
            this.cbCaptureDevices = new System.Windows.Forms.ToolStripComboBox();
            this.label14 = new System.Windows.Forms.Label();
            this.label13 = new System.Windows.Forms.Label();
            this.label12 = new System.Windows.Forms.Label();
            this.label11 = new System.Windows.Forms.Label();
            this.SourceOption1 = new System.Windows.Forms.RadioButton();
            this.SourceOption2 = new System.Windows.Forms.RadioButton();
            this.SourceOption0 = new System.Windows.Forms.RadioButton();
            this.panelLinkTitle2Lookup = new System.Windows.Forms.Panel();
            this.toolStripLocate = new System.Windows.Forms.ToolStrip();
            this.LocationBtn = new System.Windows.Forms.ToolStripButton();
            this.tbSourceLocation = new System.Windows.Forms.TextBox();
            this.SourceOption3 = new System.Windows.Forms.RadioButton();
            this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
            this.TimerAttemptConnect = new System.Windows.Forms.Timer(this.components);
            this.groupBox2.SuspendLayout();
            this.panel1.SuspendLayout();
            this.panelNoPlayer.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.TrackBarBalance)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.TrackBarVolume)).BeginInit();
            this.panelPlayBtns.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.TrackBarDuration)).BeginInit();
            this.groupBox1.SuspendLayout();
            this.panel47.SuspendLayout();
            this.toolStripCaptureDevices.SuspendLayout();
            this.panelLinkTitle2Lookup.SuspendLayout();
            this.toolStripLocate.SuspendLayout();
            this.SuspendLayout();
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.LabelResolution);
            this.groupBox2.Controls.Add(this.label15);
            this.groupBox2.Controls.Add(this.cbWidescreen);
            this.groupBox2.Controls.Add(this.LabelMediaType);
            this.groupBox2.Controls.Add(this.label10);
            this.groupBox2.Controls.Add(this.panel1);
            this.groupBox2.Controls.Add(this.cbRepeat);
            this.groupBox2.Controls.Add(this.LabelPosition);
            this.groupBox2.Controls.Add(this.LabelDuration);
            this.groupBox2.Controls.Add(this.label8);
            this.groupBox2.Controls.Add(this.label7);
            this.groupBox2.Controls.Add(this.label4);
            this.groupBox2.Controls.Add(this.label5);
            this.groupBox2.Controls.Add(this.label6);
            this.groupBox2.Controls.Add(this.label3);
            this.groupBox2.Controls.Add(this.label2);
            this.groupBox2.Controls.Add(this.TrackBarBalance);
            this.groupBox2.Controls.Add(this.TrackBarVolume);
            this.groupBox2.Controls.Add(this.cbMute);
            this.groupBox2.Controls.Add(this.panelPlayBtns);
            this.groupBox2.Controls.Add(this.label1);
            this.groupBox2.Location = new System.Drawing.Point(9, 111);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(483, 236);
            this.groupBox2.TabIndex = 1;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Settings";
            // 
            // LabelResolution
            // 
            this.LabelResolution.AutoSize = true;
            this.LabelResolution.Location = new System.Drawing.Point(71, 181);
            this.LabelResolution.Name = "LabelResolution";
            this.LabelResolution.Size = new System.Drawing.Size(27, 13);
            this.LabelResolution.TabIndex = 26;
            this.LabelResolution.Text = "N/A";
            // 
            // label15
            // 
            this.label15.AutoSize = true;
            this.label15.Location = new System.Drawing.Point(13, 181);
            this.label15.Name = "label15";
            this.label15.Size = new System.Drawing.Size(60, 13);
            this.label15.TabIndex = 25;
            this.label15.Text = "Resolution:";
            // 
            // cbWidescreen
            // 
            this.cbWidescreen.AutoSize = true;
            this.cbWidescreen.Location = new System.Drawing.Point(86, 208);
            this.cbWidescreen.Name = "cbWidescreen";
            this.cbWidescreen.Size = new System.Drawing.Size(115, 17);
            this.cbWidescreen.TabIndex = 24;
            this.cbWidescreen.Text = "Force WideScreen";
            this.cbWidescreen.CheckedChanged += new System.EventHandler(this.cbWidescreen_CheckedChanged);
            // 
            // LabelMediaType
            // 
            this.LabelMediaType.AutoSize = true;
            this.LabelMediaType.ForeColor = System.Drawing.Color.Red;
            this.LabelMediaType.Location = new System.Drawing.Point(71, 162);
            this.LabelMediaType.Name = "LabelMediaType";
            this.LabelMediaType.Size = new System.Drawing.Size(33, 13);
            this.LabelMediaType.TabIndex = 7;
            this.LabelMediaType.Text = "None";
            // 
            // label10
            // 
            this.label10.AutoSize = true;
            this.label10.Location = new System.Drawing.Point(13, 162);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(39, 13);
            this.label10.TabIndex = 21;
            this.label10.Text = "Media:";
            // 
            // panel1
            // 
            this.panel1.BackColor = System.Drawing.Color.Black;
            this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.panel1.Controls.Add(this.panelNoPlayer);
            this.panel1.Location = new System.Drawing.Point(239, 16);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(228, 175);
            this.panel1.TabIndex = 0;
            // 
            // panelNoPlayer
            // 
            this.panelNoPlayer.BackColor = System.Drawing.Color.MidnightBlue;
            this.panelNoPlayer.Controls.Add(this.label9);
            this.panelNoPlayer.Controls.Add(this.labelNoPlayer2);
            this.panelNoPlayer.Controls.Add(this.labelNoPlayer1);
            this.panelNoPlayer.ForeColor = System.Drawing.Color.White;
            this.panelNoPlayer.Location = new System.Drawing.Point(0, 0);
            this.panelNoPlayer.Name = "panelNoPlayer";
            this.panelNoPlayer.Size = new System.Drawing.Size(224, 171);
            this.panelNoPlayer.TabIndex = 60;
            // 
            // label9
            // 
            this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label9.Location = new System.Drawing.Point(14, 83);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(192, 43);
            this.label9.TabIndex = 25;
            this.label9.Text = "to view / listen to Media Backgrounds.";
            this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // labelNoPlayer2
            // 
            this.labelNoPlayer2.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.labelNoPlayer2.Location = new System.Drawing.Point(6, 47);
            this.labelNoPlayer2.Name = "labelNoPlayer2";
            this.labelNoPlayer2.Size = new System.Drawing.Size(215, 40);
            this.labelNoPlayer2.TabIndex = 24;
            this.labelNoPlayer2.Text = "Windows Media Player 10 or DirectX 9";
            this.labelNoPlayer2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // labelNoPlayer1
            // 
            this.labelNoPlayer1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.labelNoPlayer1.Location = new System.Drawing.Point(14, 28);
            this.labelNoPlayer1.Name = "labelNoPlayer1";
            this.labelNoPlayer1.Size = new System.Drawing.Size(192, 20);
            this.labelNoPlayer1.TabIndex = 0;
            this.labelNoPlayer1.Text = "Please install";
            this.labelNoPlayer1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // cbRepeat
            // 
            this.cbRepeat.AutoSize = true;
            this.cbRepeat.Location = new System.Drawing.Point(14, 208);
            this.cbRepeat.Name = "cbRepeat";
            this.cbRepeat.Size = new System.Drawing.Size(61, 17);
            this.cbRepeat.TabIndex = 8;
            this.cbRepeat.Text = "Repeat";
            this.cbRepeat.CheckedChanged += new System.EventHandler(this.cbRepeat_CheckedChanged);
            // 
            // LabelPosition
            // 
            this.LabelPosition.AutoSize = true;
            this.LabelPosition.Location = new System.Drawing.Point(71, 143);
            this.LabelPosition.Name = "LabelPosition";
            this.LabelPosition.Size = new System.Drawing.Size(28, 13);
            this.LabelPosition.TabIndex = 6;
            this.LabelPosition.Text = "0:00";
            // 
            // LabelDuration
            // 
            this.LabelDuration.AutoSize = true;
            this.LabelDuration.Location = new System.Drawing.Point(71, 125);
            this.LabelDuration.Name = "LabelDuration";
            this.LabelDuration.Size = new System.Drawing.Size(28, 13);
            this.LabelDuration.TabIndex = 5;
            this.LabelDuration.Text = "0:00";
            // 
            // label8
            // 
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(13, 143);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(47, 13);
            this.label8.TabIndex = 13;
            this.label8.Text = "Position:";
            // 
            // label7
            // 
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(13, 125);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(50, 13);
            this.label7.TabIndex = 12;
            this.label7.Text = "Duration:";
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(13, 86);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(49, 13);
            this.label4.TabIndex = 3;
            this.label4.Text = "Balance:";
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(206, 87);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(15, 13);
            this.label5.TabIndex = 9;
            this.label5.Text = "R";
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(83, 87);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(13, 13);
            this.label6.TabIndex = 8;
            this.label6.Text = "L";
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(14, 50);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(45, 13);
            this.label3.TabIndex = 1;
            this.label3.Text = "Volume:";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(206, 50);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(27, 13);
            this.label2.TabIndex = 6;
            this.label2.Text = "Max";
            // 
            // TrackBarBalance
            // 
            this.TrackBarBalance.AutoSize = false;
            this.TrackBarBalance.Location = new System.Drawing.Point(86, 83);
            this.TrackBarBalance.Maximum = 100;
            this.TrackBarBalance.Minimum = -100;
            this.TrackBarBalance.Name = "TrackBarBalance";
            this.TrackBarBalance.Size = new System.Drawing.Size(125, 37);
            this.TrackBarBalance.TabIndex = 4;
            this.TrackBarBalance.TickFrequency = 20;
            this.TrackBarBalance.ValueChanged += new System.EventHandler(this.TrackBarBalance_ValueChanged);
            // 
            // TrackBarVolume
            // 
            this.TrackBarVolume.AutoSize = false;
            this.TrackBarVolume.Location = new System.Drawing.Point(86, 38);
            this.TrackBarVolume.Maximum = 100;
            this.TrackBarVolume.Name = "TrackBarVolume";
            this.TrackBarVolume.Size = new System.Drawing.Size(125, 35);
            this.TrackBarVolume.TabIndex = 2;
            this.TrackBarVolume.TickFrequency = 10;
            this.TrackBarVolume.TickStyle = System.Windows.Forms.TickStyle.Both;
            this.TrackBarVolume.ValueChanged += new System.EventHandler(this.TrackBarVolume_ValueChanged);
            // 
            // cbMute
            // 
            this.cbMute.AutoSize = true;
            this.cbMute.Location = new System.Drawing.Point(15, 21);
            this.cbMute.Name = "cbMute";
            this.cbMute.Size = new System.Drawing.Size(50, 17);
            this.cbMute.TabIndex = 0;
            this.cbMute.Text = "Mute";
            this.cbMute.CheckedChanged += new System.EventHandler(this.cbMute_CheckedChanged);
            // 
            // panelPlayBtns
            // 
            this.panelPlayBtns.Controls.Add(this.TrackBarDuration);
            this.panelPlayBtns.Controls.Add(this.StopBtn);
            this.panelPlayBtns.Controls.Add(this.PlayPauseBtn);
            this.panelPlayBtns.Controls.Add(this.FastReverseBtn);
            this.panelPlayBtns.Controls.Add(this.FastForwardBtn);
            this.panelPlayBtns.Location = new System.Drawing.Point(231, 190);
            this.panelPlayBtns.Name = "panelPlayBtns";
            this.panelPlayBtns.Size = new System.Drawing.Size(246, 44);
            this.panelPlayBtns.TabIndex = 23;
            // 
            // TrackBarDuration
            // 
            this.TrackBarDuration.AutoSize = false;
            this.TrackBarDuration.Location = new System.Drawing.Point(0, 0);
            this.TrackBarDuration.Maximum = 1000;
            this.TrackBarDuration.Name = "TrackBarDuration";
            this.TrackBarDuration.Size = new System.Drawing.Size(242, 18);
            this.TrackBarDuration.TabIndex = 0;
            this.TrackBarDuration.TickFrequency = 0;
            this.TrackBarDuration.TickStyle = System.Windows.Forms.TickStyle.None;
            this.TrackBarDuration.Scroll += new System.EventHandler(this.TrackBarDuration_Scroll);
            // 
            // StopBtn
            // 
            this.StopBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.StopBtn.Location = new System.Drawing.Point(162, 18);
            this.StopBtn.Name = "StopBtn";
            this.StopBtn.Size = new System.Drawing.Size(42, 22);
            this.StopBtn.TabIndex = 4;
            this.StopBtn.Text = "Stop";
            this.StopBtn.Click += new System.EventHandler(this.StopBtn_Click);
            // 
            // PlayPauseBtn
            // 
            this.PlayPauseBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.PlayPauseBtn.Location = new System.Drawing.Point(111, 18);
            this.PlayPauseBtn.Name = "PlayPauseBtn";
            this.PlayPauseBtn.Size = new System.Drawing.Size(48, 22);
            this.PlayPauseBtn.TabIndex = 3;
            this.PlayPauseBtn.Text = "Play";
            this.PlayPauseBtn.Click += new System.EventHandler(this.PlayPauseBtn_Click);
            // 
            // FastReverseBtn
            // 
            this.FastReverseBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.FastReverseBtn.Location = new System.Drawing.Point(39, 18);
            this.FastReverseBtn.Name = "FastReverseBtn";
            this.FastReverseBtn.Size = new System.Drawing.Size(32, 22);
            this.FastReverseBtn.TabIndex = 1;
            this.FastReverseBtn.Text = "<<";
            this.FastReverseBtn.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FastReverseBtn_MouseDown);
            this.FastReverseBtn.MouseUp += new System.Windows.Forms.MouseEventHandler(this.FastReverseBtn_MouseUp);
            // 
            // FastForwardBtn
            // 
            this.FastForwardBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.FastForwardBtn.Location = new System.Drawing.Point(75, 18);
            this.FastForwardBtn.Name = "FastForwardBtn";
            this.FastForwardBtn.Size = new System.Drawing.Size(32, 22);
            this.FastForwardBtn.TabIndex = 2;
            this.FastForwardBtn.Text = ">>";
            this.FastForwardBtn.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FastForwardBtn_MouseDown);
            this.FastForwardBtn.MouseUp += new System.Windows.Forms.MouseEventHandler(this.FastForwardBtn_MouseUp);
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(65, 50);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(24, 13);
            this.label1.TabIndex = 5;
            this.label1.Text = "Min";
            // 
            // BtnCancel
            // 
            this.BtnCancel.Location = new System.Drawing.Point(256, 356);
            this.BtnCancel.Name = "BtnCancel";
            this.BtnCancel.Size = new System.Drawing.Size(80, 24);
            this.BtnCancel.TabIndex = 3;
            this.BtnCancel.Text = "Cancel";
            // 
            // BtnOK
            // 
            this.BtnOK.Location = new System.Drawing.Point(160, 356);
            this.BtnOK.Name = "BtnOK";
            this.BtnOK.Size = new System.Drawing.Size(80, 24);
            this.BtnOK.TabIndex = 2;
            this.BtnOK.Text = "OK";
            this.BtnOK.Click += new System.EventHandler(this.BtnOK_Click);
            // 
            // OpenFileDialog1
            // 
            this.OpenFileDialog1.FileName = "openFileDialog1";
            // 
            // TimerFast
            // 
            this.TimerFast.Interval = 500;
            this.TimerFast.Tick += new System.EventHandler(this.TimerFast_Tick);
            // 
            // TimerTrack
            // 
            this.TimerTrack.Interval = 1000;
            this.TimerTrack.Tick += new System.EventHandler(this.TimerTrack_Tick);
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.panel47);
            this.groupBox1.Controls.Add(this.label14);
            this.groupBox1.Controls.Add(this.label13);
            this.groupBox1.Controls.Add(this.label12);
            this.groupBox1.Controls.Add(this.label11);
            this.groupBox1.Controls.Add(this.SourceOption1);
            this.groupBox1.Controls.Add(this.SourceOption2);
            this.groupBox1.Controls.Add(this.SourceOption0);
            this.groupBox1.Controls.Add(this.panelLinkTitle2Lookup);
            this.groupBox1.Controls.Add(this.tbSourceLocation);
            this.groupBox1.Controls.Add(this.SourceOption3);
            this.groupBox1.Location = new System.Drawing.Point(9, 5);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(483, 103);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Source Option";
            // 
            // panel47
            // 
            this.panel47.Controls.Add(this.toolStripCaptureDevices);
            this.panel47.Location = new System.Drawing.Point(128, 76);
            this.panel47.Name = "panel47";
            this.panel47.Size = new System.Drawing.Size(231, 22);
            this.panel47.TabIndex = 71;
            // 
            // toolStripCaptureDevices
            // 
            this.toolStripCaptureDevices.AutoSize = false;
            this.toolStripCaptureDevices.CanOverflow = false;
            this.toolStripCaptureDevices.Dock = System.Windows.Forms.DockStyle.None;
            this.toolStripCaptureDevices.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
            this.toolStripCaptureDevices.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.cbCaptureDevices});
            this.toolStripCaptureDevices.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
            this.toolStripCaptureDevices.Location = new System.Drawing.Point(1, -1);
            this.toolStripCaptureDevices.Name = "toolStripCaptureDevices";
            this.toolStripCaptureDevices.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
            this.toolStripCaptureDevices.Size = new System.Drawing.Size(242, 25);
            this.toolStripCaptureDevices.TabIndex = 5;
            // 
            // cbCaptureDevices
            // 
            this.cbCaptureDevices.AutoSize = false;
            this.cbCaptureDevices.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbCaptureDevices.Name = "cbCaptureDevices";
            this.cbCaptureDevices.Size = new System.Drawing.Size(220, 23);
            this.cbCaptureDevices.SelectedIndexChanged += new System.EventHandler(this.cbCaptureDevicesAndTypes_SelectedIndexChanged);
            // 
            // label14
            // 
            this.label14.AutoSize = true;
            this.label14.Location = new System.Drawing.Point(6, 80);
            this.label14.Name = "label14";
            this.label14.Size = new System.Drawing.Size(16, 13);
            this.label14.TabIndex = 66;
            this.label14.Text = "4:";
            // 
            // label13
            // 
            this.label13.AutoSize = true;
            this.label13.Location = new System.Drawing.Point(6, 59);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(16, 13);
            this.label13.TabIndex = 65;
            this.label13.Text = "3:";
            // 
            // label12
            // 
            this.label12.AutoSize = true;
            this.label12.Location = new System.Drawing.Point(6, 38);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(16, 13);
            this.label12.TabIndex = 64;
            this.label12.Text = "2:";
            // 
            // label11
            // 
            this.label11.AutoSize = true;
            this.label11.Location = new System.Drawing.Point(6, 18);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(16, 13);
            this.label11.TabIndex = 63;
            this.label11.Text = "1:";
            // 
            // SourceOption1
            // 
            this.SourceOption1.AutoSize = true;
            this.SourceOption1.Location = new System.Drawing.Point(28, 36);
            this.SourceOption1.MaximumSize = new System.Drawing.Size(463, 17);
            this.SourceOption1.Name = "SourceOption1";
            this.SourceOption1.Size = new System.Drawing.Size(28, 17);
            this.SourceOption1.TabIndex = 1;
            this.SourceOption1.Text = " ";
            this.SourceOption1.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            // 
            // SourceOption2
            // 
            this.SourceOption2.AutoSize = true;
            this.SourceOption2.Location = new System.Drawing.Point(28, 59);
            this.SourceOption2.Name = "SourceOption2";
            this.SourceOption2.Size = new System.Drawing.Size(14, 13);
            this.SourceOption2.TabIndex = 2;
            this.SourceOption2.CheckedChanged += new System.EventHandler(this.SourceOption2_CheckedChanged);
            // 
            // SourceOption0
            // 
            this.SourceOption0.AutoSize = true;
            this.SourceOption0.Location = new System.Drawing.Point(28, 16);
            this.SourceOption0.Name = "SourceOption0";
            this.SourceOption0.Size = new System.Drawing.Size(71, 17);
            this.SourceOption0.TabIndex = 0;
            this.SourceOption0.Text = "No Media";
            // 
            // panelLinkTitle2Lookup
            // 
            this.panelLinkTitle2Lookup.Controls.Add(this.toolStripLocate);
            this.panelLinkTitle2Lookup.Location = new System.Drawing.Point(454, 54);
            this.panelLinkTitle2Lookup.Name = "panelLinkTitle2Lookup";
            this.panelLinkTitle2Lookup.Size = new System.Drawing.Size(23, 23);
            this.panelLinkTitle2Lookup.TabIndex = 3;
            // 
            // toolStripLocate
            // 
            this.toolStripLocate.AutoSize = false;
            this.toolStripLocate.CanOverflow = false;
            this.toolStripLocate.Dock = System.Windows.Forms.DockStyle.None;
            this.toolStripLocate.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
            this.toolStripLocate.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.LocationBtn});
            this.toolStripLocate.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
            this.toolStripLocate.Location = new System.Drawing.Point(0, -1);
            this.toolStripLocate.Name = "toolStripLocate";
            this.toolStripLocate.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
            this.toolStripLocate.Size = new System.Drawing.Size(25, 28);
            this.toolStripLocate.TabIndex = 5;
            // 
            // LocationBtn
            // 
            this.LocationBtn.AutoSize = false;
            this.LocationBtn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.LocationBtn.Image = global::Properties.Resources.open;
            this.LocationBtn.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.LocationBtn.Name = "LocationBtn";
            this.LocationBtn.Size = new System.Drawing.Size(22, 22);
            this.LocationBtn.Tag = "";
            this.LocationBtn.ToolTipText = "Media File Location";
            this.LocationBtn.MouseUp += new System.Windows.Forms.MouseEventHandler(this.LocationBtn_MouseUp);
            // 
            // tbSourceLocation
            // 
            this.tbSourceLocation.Location = new System.Drawing.Point(45, 55);
            this.tbSourceLocation.Name = "tbSourceLocation";
            this.tbSourceLocation.Size = new System.Drawing.Size(404, 20);
            this.tbSourceLocation.TabIndex = 62;
            this.tbSourceLocation.TextChanged += new System.EventHandler(this.tbSourceLocation_TextChanged);
            // 
            // SourceOption3
            // 
            this.SourceOption3.AutoSize = true;
            this.SourceOption3.Location = new System.Drawing.Point(28, 78);
            this.SourceOption3.Name = "SourceOption3";
            this.SourceOption3.Size = new System.Drawing.Size(98, 17);
            this.SourceOption3.TabIndex = 4;
            this.SourceOption3.Text = "Live Feed from:";
            this.SourceOption3.CheckedChanged += new System.EventHandler(this.SourceOption3_CheckedChanged);
            // 
            // TimerAttemptConnect
            // 
            this.TimerAttemptConnect.Interval = 500;
            this.TimerAttemptConnect.Tick += new System.EventHandler(this.TimerAttemptConnect_Tick);
            // 
            // FrmMediaPlayerControl
            // 
            this.AcceptButton = this.BtnOK;
            this.ClientSize = new System.Drawing.Size(501, 391);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.BtnCancel);
            this.Controls.Add(this.BtnOK);
            this.Controls.Add(this.groupBox2);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FrmMediaPlayerControl";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Assign Media";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMediaPlayerControl_FormClosing);
            this.Load += new System.EventHandler(this.FrmMediaPlayerControl_Load);
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.panel1.ResumeLayout(false);
            this.panelNoPlayer.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.TrackBarBalance)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.TrackBarVolume)).EndInit();
            this.panelPlayBtns.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.TrackBarDuration)).EndInit();
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.panel47.ResumeLayout(false);
            this.toolStripCaptureDevices.ResumeLayout(false);
            this.toolStripCaptureDevices.PerformLayout();
            this.panelLinkTitle2Lookup.ResumeLayout(false);
            this.toolStripLocate.ResumeLayout(false);
            this.toolStripLocate.PerformLayout();
            this.ResumeLayout(false);

        }
        public FrmMediaPlayerControl()
        {
            this.InitializeComponent();
        }
        private void FrmMediaPlayerControl_Load(object sender, EventArgs e)
        {
            this.BtnOK.DialogResult = DialogResult.OK;
            this.BtnCancel.DialogResult = DialogResult.Cancel;
            this.groupBox1.Enabled = (!(gf.Temp_MediaItemType == "M") || gf.MPC_Type != gf.MPCType.Individual);
            if (gf.MPC_Type == gf.MPCType.Individual)
            {
                this.Text = "Assign Media " + ((gf.Temp_MediaTitle1 != "") ? "for " : "") + gf.Temp_MediaTitle1;
            }
            else
            {
                this.Text = "Assign Media - Default Settings";
            }
            this.SourceOption1.Text = "Play Media File based on Item Title (if any)";
            gf.LoadBlankCaptureDevices(ref this.cbCaptureDevices);
            this.InitMediaPlayer();
            this.tbSourceLocation.Text = gf.Temp_MediaLocation;
            this.cbCaptureDevices.SelectedIndex = gf.Temp_MediaCaptureDeviceNumber - 1;
            this.TrackBarVolume.Value = ((gf.Temp_MediaVolume >= 0 & gf.Temp_MediaVolume <= 100) ? gf.Temp_MediaVolume : 50);
            this.TrackBarBalance.Value = ((gf.Temp_MediaBalance >= -100 & gf.Temp_MediaBalance <= 100) ? gf.Temp_MediaBalance : 0);
            this.cbMute.Checked = (gf.Temp_MediaMute > 0);
            this.cbRepeat.Checked = (gf.Temp_MediaRepeat > 0);
            this.cbWidescreen.Checked = (gf.Temp_MediaWidescreen > 0);
            this.LabelMediaType.Text = "";
            this.LabelResolution.Text = "";
            this.AssignSourceOption(gf.Temp_MediaOption);
            this.DShowPlayer.SetCurrentPosition((double)gf.Temp_MediaOption);
            this.ApplySoundControls(false);
            this.TimerTrack.Start();
            this.InitLoad = false;
        }
        private void InitMediaPlayer()
        {
            if (gf.WMP_Present)
            {
                try
                {
                    this.DShowPlayer.Parent = this;
                    this.DShowPlayer.Parent = this.panel1;
                    this.DShowPlayer.Location = new Point(0, 0);
                    this.DShowPlayer.SetDefaultSize(0, 0, this.panel1.Width, this.panel1.Height, (gf.VAlign)gf.VideoVAlign);
                    this.DShowPlayer.ForeColorChanged += new EventHandler(this.DShowPlayer_ForeColorChanged);
                    this.DShowPlayer.ListCaptureDevices(ref this.cbCaptureDevices);
                    this.PlayerOK = true;
                }
                catch
                {
                    this.PlayerOK = false;
                }
            }
            if (this.PlayerOK)
            {
                this.DShowPlayer.Dock = DockStyle.Fill;
                this.DShowPlayer.newFilename = this.tbSourceLocation.Text;
                this.panelNoPlayer.Visible = false;
                this.EnableMediaControls(true);
                this.DShowPlayer.Visible = true;
            }
            else
            {
                this.EnableMediaControls(false);
            }
        }
        private void EnableMediaControls(bool MediaOn)
        {
            this.panelNoPlayer.Visible = !MediaOn;
            this.panelPlayBtns.Enabled = MediaOn;
        }
        private void AssignSourceOption(int InOption)
        {
            switch (InOption)
            {
                case 1:
                    this.SourceOption1.Checked = true;
                    break;
                case 2:
                    this.SourceOption2.Checked = true;
                    break;
                case 3:
                    this.SourceOption3.Checked = true;
                    break;
                default:
                    this.SourceOption0.Checked = true;
                    break;
            }
        }
        private void TrackBarVolume_ValueChanged(object sender, EventArgs e)
        {
            if (!this.InitLoad)
            {
                this.ApplySoundControls(false);
            }
        }
        private void TrackBarBalance_ValueChanged(object sender, EventArgs e)
        {
            if (!this.InitLoad)
            {
                this.ApplySoundControls(false);
            }
        }
        private void cbMute_CheckedChanged(object sender, EventArgs e)
        {
            if (!this.InitLoad)
            {
                this.ApplySoundControls(false);
            }
        }
        private void cbRepeat_CheckedChanged(object sender, EventArgs e)
        {
            if (!this.InitLoad)
            {
                this.ApplySoundControls(false);
            }
        }
        private void cbWidescreen_CheckedChanged(object sender, EventArgs e)
        {
            this.SetWideScreen(this.cbWidescreen.Checked);
        }
        private void SetWideScreen(bool InMode)
        {
            if (this.PlayerOK)
            {
                this.DShowPlayer.SetWideScreen(InMode, true);
                this.LabelResolution.Text = this.DShowPlayer.GetVideoSize();
            }
        }
        private void ApplySoundControls(bool ApplyMute)
        {
            if (this.PlayerOK)
            {
                this.DShowPlayer.SetVolume(this.TrackBarVolume.Value);
                this.DShowPlayer.SetBalance(this.TrackBarBalance.Value);
                this.DShowPlayer.SetMute(ApplyMute || this.cbMute.Checked);
                this.DShowPlayer.LoopClip = this.cbRepeat.Checked;
            }
        }
        private void PlayPauseBtn_Click(object sender, EventArgs e)
        {
            this.ApplyPlayControls(FrmMediaPlayerControl.ControlsBtn.PlayPausebtn);
        }
        private void StopBtn_Click(object sender, EventArgs e)
        {
            this.ApplyPlayControls(FrmMediaPlayerControl.ControlsBtn.Stopbtn);
        }
        private void FastReverseBtn_MouseDown(object sender, MouseEventArgs e)
        {
            this.ApplyPlayControls(FrmMediaPlayerControl.ControlsBtn.FRbtn);
        }
        private void FastReverseBtn_MouseUp(object sender, MouseEventArgs e)
        {
            this.ReturnToPreviousState();
        }
        private void FastForwardBtn_MouseDown(object sender, MouseEventArgs e)
        {
            this.ApplyPlayControls(FrmMediaPlayerControl.ControlsBtn.FFbtn);
        }
        private void FastForwardBtn_MouseUp(object sender, MouseEventArgs e)
        {
            this.ReturnToPreviousState();
        }
        private void StorePreviousStatus()
        {
            this.PreviousMuteState = this.cbMute.Checked;
        }
        private void ReturnToPreviousState()
        {
            this.TimerFast.Stop();
            this.ApplySoundControls(false);
        }
        private void ApplyPlayControls(FrmMediaPlayerControl.ControlsBtn InAction)
        {
            if (this.PlayerOK)
            {
                this.TimerFast.Stop();
                if (InAction == FrmMediaPlayerControl.ControlsBtn.PlayPausebtn)
                {
                    if (this.SourceOption3.Checked || (this.DShowPlayer.currentState != gf.PlayState.Running && this.DShowPlayer.currentState != gf.PlayState.Paused))
                    {
                        this.tbSourceLocation.Text = gf.Trim(this.tbSourceLocation.Text);
                        int selectedSourceOption = this.GetSelectedSourceOption();
                        try
                        {
                            switch (selectedSourceOption)
                            {
                                case 1:
                                    this.Option1MediaFile = gf.GetMediaFileName(gf.Temp_MediaTitle1, gf.Temp_MediaTitle2);
                                    if (this.Option1MediaFile == "")
                                    {
                                        this.SourceOption1.Text = "Play Media File based on Item Title (if any)";
                                        this.toolTip1.SetToolTip(this.SourceOption1, "");
                                    }
                                    else
                                    {
                                        this.SourceOption1.Text = this.Option1MediaFile;
                                        this.toolTip1.SetToolTip(this.SourceOption1, this.SourceOption1.Text);
                                    }
                                    this.DShowPlayer.newFilename = this.Option1MediaFile;
                                    break;
                                case 2:
                                    this.DShowPlayer.newFilename = this.tbSourceLocation.Text;
                                    break;
                                case 3:
                                    this.DShowPlayer.newFilename = "<<Capture>>";
                                    this.DShowPlayer.currentInputDevice = this.cbCaptureDevices.SelectedIndex + 1;
                                    break;
                                default:
                                    this.DShowPlayer.newFilename = "";
                                    break;
                            }
                            this.SetWideScreen(this.cbWidescreen.Checked);
                            if (selectedSourceOption == 3 || this.DShowPlayer.newFilename != "")
                            {
                                this.DShowPlayer.OpenClip();
                                this.AttemptConnectCount = 0;
                                this.LabelMediaType.Text = this.DShowPlayer.GetStatusText();
                                this.LabelResolution.Text = this.DShowPlayer.GetVideoSize();
                            }
                            else
                            {
                                this.ResetMediaMessages();
                            }
                        }
                        catch
                        {
                            this.DShowPlayer.newFilename = "";
                            this.ResetMediaMessages();
                        }
                        return;
                    }
                    this.DShowPlayer.PausePlayClip();
                }
                else
                {
                    if (InAction == FrmMediaPlayerControl.ControlsBtn.Stopbtn)
                    {
                        this.DShowPlayer.StopClip();
                    }
                    else
                    {
                        if (InAction == FrmMediaPlayerControl.ControlsBtn.FFbtn)
                        {
                            this.StorePreviousStatus();
                            this.ApplySoundControls(true);
                            this.IncrementCurrentPosition(1.0);
                            this.TimeIncrement = 5.0;
                            this.TimerFast.Start();
                        }
                        else
                        {
                            if (InAction == FrmMediaPlayerControl.ControlsBtn.FRbtn)
                            {
                                this.ApplySoundControls(true);
                                this.StorePreviousStatus();
                                this.IncrementCurrentPosition(-1.0);
                                this.TimeIncrement = -5.0;
                                this.TimerFast.Start();
                            }
                            else
                            {
                                if (InAction == FrmMediaPlayerControl.ControlsBtn.Closebtn)
                                {
                                    this.DShowPlayer.StopClip();
                                }
                            }
                        }
                    }
                }
                this.Cursor = Cursors.Default;
            }
        }
        private void ResetMediaMessages()
        {
            if (this.PlayerOK)
            {
                this.LabelMediaType.Text = this.DShowPlayer.GetStatusText();
                this.LabelResolution.Text = this.DShowPlayer.GetVideoSize();
            }
            else
            {
                this.LabelMediaType.Text = "";
                this.LabelResolution.Text = "";
            }
            this.Cursor = Cursors.Default;
        }
        private void DShowPlayer_ForeColorChanged(object sender, EventArgs e)
        {
            switch (this.DShowPlayer.currentState)
            {
                case gf.PlayState.Stopped:
                    this.StopBtn.Enabled = false;
                    this.PlayPauseBtn.Text = "Play";
                    this.Cursor = Cursors.Default;
                    break;
                case gf.PlayState.Paused:
                    this.PlayPauseBtn.Text = "Play";
                    this.Cursor = Cursors.Default;
                    break;
                case gf.PlayState.Running:
                    this.PlayPauseBtn.Enabled = true;
                    this.StopBtn.Enabled = true;
                    this.PlayPauseBtn.Text = "Pause";
                    this.LabelMediaType.Text = this.DShowPlayer.GetStatusText();
                    this.LabelResolution.Text = this.DShowPlayer.GetVideoSize();
                    this.Cursor = Cursors.Default;
                    break;
                default:
                    this.StopBtn.Enabled = false;
                    this.PlayPauseBtn.Text = "Play";
                    break;
            }
        }
        private void FrmMediaPlayerControl_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.ApplyPlayControls(FrmMediaPlayerControl.ControlsBtn.Closebtn);
            this.DShowPlayer.TidyUp();
            this.TimerTrack.Stop();
            this.TimerFast.Stop();
        }
        private void BtnOK_Click(object sender, EventArgs e)
        {
            gf.Temp_MediaOption = this.GetSelectedSourceOption();
            gf.Temp_MediaLocation = gf.Trim(this.tbSourceLocation.Text);
            gf.Temp_MediaCaptureDeviceNumber = this.cbCaptureDevices.SelectedIndex + 1;
            gf.Temp_MediaVolume = this.TrackBarVolume.Value;
            gf.Temp_MediaBalance = this.TrackBarBalance.Value;
            gf.Temp_MediaMute = (this.cbMute.Checked ? 1 : 0);
            gf.Temp_MediaPosition = TrackBarDuration.Value;
            gf.Temp_MediaRepeat = (this.cbRepeat.Checked ? 1 : 0);
            gf.Temp_MediaWidescreen = (this.cbWidescreen.Checked ? 1 : 0);

        }
        private int GetSelectedSourceOption()
        {
            int result;
            if (this.SourceOption1.Checked)
            {
                result = 1;
            }
            else
            {
                if (this.SourceOption2.Checked)
                {
                    result = 2;
                }
                else
                {
                    if (this.SourceOption3.Checked)
                    {
                        result = 3;
                    }
                    else
                    {
                        result = 0;
                    }
                }
            }
            return result;
        }
        private void LocationBtn_MouseUp(object sender, MouseEventArgs e)
        {
            this.OpenFileDialog1.Filter = gf.GetOpenFileDialogMediaString();
            this.OpenFileDialog1.InitialDirectory = gf.MediaDir;
            this.OpenFileDialog1.AddExtension = true;
            this.tbSourceLocation.Text = gf.Trim(this.tbSourceLocation.Text);
            this.OpenFileDialog1.FileName = this.tbSourceLocation.Text;
            bool flag = false;
            try
            {
                if (this.OpenFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    this.ApplyPlayControls(FrmMediaPlayerControl.ControlsBtn.Stopbtn);
                    this.tbSourceLocation.Text = this.OpenFileDialog1.FileName;
                    if (this.PlayerOK)
                    {
                        this.DShowPlayer.newFilename = this.tbSourceLocation.Text;
                    }
                    this.ApplySoundControls(false);
                }
            }
            catch
            {
                flag = true;
            }
            if (flag)
            {
                try
                {
                    this.OpenFileDialog1.FileName = "";
                    if (this.OpenFileDialog1.ShowDialog() == DialogResult.OK)
                    {
                        this.ApplyPlayControls(FrmMediaPlayerControl.ControlsBtn.Stopbtn);
                        this.tbSourceLocation.Text = this.OpenFileDialog1.FileName;
                        if (this.PlayerOK)
                        {
                            this.DShowPlayer.newFilename = this.tbSourceLocation.Text;
                        }
                        this.ApplySoundControls(false);
                    }
                }
                catch
                {
                }
            }
        }
        private void TimerFast_Tick(object sender, EventArgs e)
        {
            this.IncrementCurrentPosition(this.TimeIncrement);
        }
        private void IncrementCurrentPosition(double InIncrement)
        {
            if (this.PlayerOK)
            {
                this.DShowPlayer.SetCurrentPosition((double)this.DShowPlayer.GetCurrentPosition() + InIncrement);
                this.SetDurationSettings();
            }
        }
        private void SetDurationSettings()
        {
            if (this.PlayerOK && this.DShowPlayer.GetClipDuration() > 0)
            {
                this.SetDurationSettings(false);
            }
            else
            {
                this.SetDurationSettings(true);
            }
        }
        private void SetDurationSettings(bool ResetAll)
        {
            if (ResetAll)
            {
                if (this.LabelMediaType.Text != "" && (this.LabelMediaType.Text[0] == 'A' | this.LabelMediaType.Text[0] == 'V'))
                {
                    this.LabelDuration.Text = "Streaming Contents";
                }
                else
                {
                    this.LabelDuration.Text = "00:00";
                }
                this.LabelPosition.Text = "00:00";
                this.TrackBarDuration.Maximum = 0;
                this.TrackBarDuration.Value = 0;
            }
            else
            {
                if (this.PlayerOK)
                {
                    this.LabelDuration.Text = ((this.DShowPlayer.newFilename != "") ? this.DShowPlayer.GetClipDurationString() : "00:00");
                    this.LabelPosition.Text = this.DShowPlayer.GetCurrentPositionString();
                    this.TrackBarDuration.Maximum = this.DShowPlayer.GetClipDuration();
                    this.TrackBarDuration.Value = ((this.DShowPlayer.GetCurrentPosition() > this.TrackBarDuration.Maximum) ? this.TrackBarDuration.Maximum : this.DShowPlayer.GetCurrentPosition());
                }
                else
                {
                    this.LabelDuration.Text = "00:00";
                    this.LabelPosition.Text = "00:00";
                    this.TrackBarDuration.Maximum = 1000;
                    this.TrackBarDuration.Value = 0;
                }
            }
        }
        private void TimerTrack_Tick(object sender, EventArgs e)
        {
            this.SetDurationSettings();
        }
        private void TrackBarDuration_Scroll(object sender, EventArgs e)
        {
            if (this.PlayerOK)
            {
                this.DShowPlayer.SetCurrentPosition((double)this.TrackBarDuration.Value);
            }
        }
        private void tbSourceLocation_TextChanged(object sender, EventArgs e)
        {
            if (!this.InitLoad)
            {
                this.SourceOption2.Checked = true;
            }
        }
        private void TimerAttemptConnect_Tick(object sender, EventArgs e)
        {
        }
        private void SourceOption3_CheckedChanged(object sender, EventArgs e)
        {
            if (this.SourceOption3.Checked)
            {
                this.RestartInputDevice();
            }
        }
        private void RestartInputDevice()
        {
            this.ApplyPlayControls(FrmMediaPlayerControl.ControlsBtn.Stopbtn);
            this.ApplyPlayControls(FrmMediaPlayerControl.ControlsBtn.PlayPausebtn);
        }
        private void SourceOption2_CheckedChanged(object sender, EventArgs e)
        {
            if (this.SourceOption2.Checked)
            {
                this.ApplyPlayControls(FrmMediaPlayerControl.ControlsBtn.Stopbtn);
            }
        }
        private void cbCaptureDevicesAndTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!this.InitLoad)
            {
                if (this.SourceOption3.Checked)
                {
                    this.RestartInputDevice();
                }
            }
        }

    }
}
